using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Auto.Data.HumanResource;

namespace BaseSystem._System.UserControl
{
    public partial class ucDivision : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindDropDown();
            }
        }

        private void BindDropDown()
        {
            #region --Division--
            Division division = new Division();
            DataTable dt = division.GetList("");
            foreach (DataRow dr in dt.Rows)
            {
                this.ddlDiv.Items.Add(new ListItem(dr[Division.FIELD_DivID] + "." + dr[Division.FIELD_DivName], dr[Division.FIELD_DivID].ToString()));
            }
            #endregion --Division--
        }

        #region Value
        public string DivID
        {
            get { return this.ddlDiv.SelectedValue; }
            set
            {
                ListItem item = this.ddlDiv.Items.FindByValue(value);
                if (item != null)
                {
                    this.ddlDiv.ClearSelection();
                    item.Selected = true;
                }
            }
        }

        public bool Enable
        {
            
            set
            {
                this.ddlDiv.Enabled = value;
            }
        }
        #endregion Value
    }
}